package com.base.action;

import java.util.List;

import com.base.bean.Cardseries;
import com.base.service.CardTypeService;
import com.base.service.CardseriesService;
import com.common.bean.Cardsubtype;
import com.common.util.PagerModel;
import com.core.ssh2.AbstractActionSupport;
import com.opensymphony.xwork2.Preparable;

public class CardseriesManagerAction extends AbstractActionSupport implements Preparable{
	private static final long serialVersionUID = -6119378326968027686L;

	private CardseriesService cardseriesService;
	
	private CardTypeService cardTypeService;
	
	private Cardseries cardseries;
	
	private long seriesno;
	
	private PagerModel pm;
	
	private List<Cardsubtype> cardsubtypelist;
	
	public void prepare() throws Exception {
		cardsubtypelist = cardTypeService.findAllCardsubtype();
	}
	
	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}
	
	public String goAddCardseries() throws Exception {
		return SUCCESS;
	}
	
	public String addCardseries() throws Exception {
		cardseriesService.addCardseries(cardseries);
		return SUCCESS;
	}
	
	public String delCardseries() throws Exception {
		cardseriesService.removeCardseries(seriesno);
		return SUCCESS;
	}
	
	public String findCardserieslist() throws Exception {
		pm = cardseriesService.findCardseriesForPager();
		return SUCCESS;
	}
	
	public String findCardseries() throws Exception {
		cardseries = cardseriesService.findCardseries(seriesno);
		return SUCCESS;
	}
	
	public String getCardseriesForUpdate() throws Exception {
		cardseries = cardseriesService.findCardseries(seriesno);
		return SUCCESS;
	}
	
	public String updateCardseries() throws Exception {
		cardseriesService.updateCardseries(cardseries);
		return SUCCESS;
	}

	/**
	 * @return the cardseries
	 */
	public Cardseries getCardseries() {
		return cardseries;
	}

	/**
	 * @param cardseries the cardseries to set
	 */
	public void setCardseries(Cardseries cardseries) {
		this.cardseries = cardseries;
	}

	/**
	 * @return the cardseriesService
	 */
	public CardseriesService getCardseriesService() {
		return cardseriesService;
	}

	/**
	 * @param cardseriesService the cardseriesService to set
	 */
	public void setCardseriesService(CardseriesService cardseriesService) {
		this.cardseriesService = cardseriesService;
	}

	/**
	 * @return the cardsubtypelist
	 */
	public List<Cardsubtype> getCardsubtypelist() {
		return cardsubtypelist;
	}

	/**
	 * @param cardsubtypelist the cardsubtypelist to set
	 */
	public void setCardsubtypelist(List<Cardsubtype> cardsubtypelist) {
		this.cardsubtypelist = cardsubtypelist;
	}

	/**
	 * @return the cardTypeService
	 */
	public CardTypeService getCardTypeService() {
		return cardTypeService;
	}

	/**
	 * @param cardTypeService the cardTypeService to set
	 */
	public void setCardTypeService(CardTypeService cardTypeService) {
		this.cardTypeService = cardTypeService;
	}

	/**
	 * @return the pm
	 */
	public PagerModel getPm() {
		return pm;
	}

	/**
	 * @param pm the pm to set
	 */
	public void setPm(PagerModel pm) {
		this.pm = pm;
	}

	/**
	 * @return the seriesno
	 */
	public long getSeriesno() {
		return seriesno;
	}

	/**
	 * @param seriesno the seriesno to set
	 */
	public void setSeriesno(long seriesno) {
		this.seriesno = seriesno;
	}
	
}
